import { createRouter, createWebHistory } from 'vue-router'

import LayoutView from '@/components/LayoutView.vue'
import ShopView from '@/components/ShopView.vue'
import AddressView from '@/views/address/AddressView.vue'
import CreateAddressView from '@/views/address/CreateAddressView.vue'
import OrderConfirmationView from '@/views/orderConfirmation/OrderConfirmationView.vue'


import HomeView from '@/views/home/HomeView.vue'
import CartCard from '@/components/cart/CartCard.vue'
import CartView from '@/views/cart/CartView.vue'
import OrderView from '@/views/order/OrderView.vue'
import MyView from '@/views/my/MyView.vue'




const router = createRouter({
  history: createWebHistory(),
  routes: [
    {
      path: '/',
      redirect:'/home'
    },
    // 首页
    {
      path: '/',
      name: 'home',
      component: LayoutView,
      children:[
        {
          path:'home',
          component:HomeView
        }
      ]
    },
    // 购物车
    {
      path: '/cart',
      component: LayoutView,
      children:[
        {
          path:'',
          component:CartView
        }
      ]
    },
    // 订单
    {
      path: '/order',
      component: LayoutView,
      children:[
        {
          path:'',
          component:OrderView
        }
      ]
    },
    // 我的
    {
      path: '/my',
      component: LayoutView,
      children:[
        {
          path:'',
          component:MyView
        }
      ]
    },
    // 商店页面
    {
      path: '/shopView',
      name:'shop',
      component: ShopView
    },
    // 下订单页面
    {
      path: '/orderCV',
      component: OrderConfirmationView,
    },
    // 地址
    {
      path: '/address',
      component: AddressView,
    },
    // 添加地址
    {
      path: '/createaddress',
      component: CreateAddressView,
    }
  ]
})

export default router